home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / VBE20SRC.ZIP / VGOVBE20.H < prev    next >
C/C++ Source or Header  |  1997-03-25  |  8KB  |  209 lines

  1. //▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  2. // File        : VGOVBE20.H
  3. // Description : Vesa Bios Extention 2.0 header file
  4. // Notes       : Brought to you by Vertigo. If you use this, or have
  5. //               learned from this, send us an email and/or Greet us
  6. //               In your demo =).
  7. //
  8. //▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  9.  
  10. #ifndef __VGOVBE20_H
  11. #define __VGOVBE20_H
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.  
  17. // Vesa surface structure
  18.  
  19. typedef struct vbesurface
  20. {
  21.   long          vbeMode;        // VBE mode number
  22.   long         width;        // width of screen
  23.   long          height;        // height of screen
  24.   long          bits;            // bits per pixel
  25.   long          depth;        // bytes per pixel
  26.   char       * lfb;            // pointer to LFB
  27.  
  28. } VBESURFACE;
  29.  
  30. // Vesa infomation block
  31.  
  32. typedef _Packed struct
  33. {
  34.   char          VbeSignature[4];    // 'VESA' 4 byte signature
  35.   short       VbeVersion;           // VBE version number
  36.   char         *OemStringPtr;         // Pointer to OEM string
  37.   unsigned long      Capabilities;         // Capabilities of video card
  38.   unsigned short *VideoModePtr;        // Pointer to supported modes
  39.   short         TotalMemory;          // Number of 64kb memory blocks
  40.  
  41.   short          OemSoftwareRev;    // OEM Software revision number
  42.   char         *OemVendorNamePtr;    // Pointer to Vendor Name string
  43.   char         *OemProductNamePtr;    // Pointer to Product Name string
  44.   char         *OemProductRevPtr;    // Pointer to Product Revision str
  45.   char        reserved[222];           // Pad to 256 byte block size
  46.   char          OemDATA[256];        // Scratch pad for OEM data
  47.  
  48. } VBEINFO;
  49.  
  50. #define    VBE_CAPS_8BITDAC    (1<<0)    // DAC can be 8 bit
  51. #define    VBE_CAPS_NONVGA         (1<<1)    // Non-vga compatible controller
  52. #define    VBE_CAPS_BLANKRAMDAC     (1<<2)    // Programmed DAC with blank bit
  53.  
  54. // Vesa mode infomation block
  55.  
  56. typedef _Packed struct
  57. {
  58.   // Mandatory information for all VBE revisions:
  59.  
  60.   unsigned short  ModeAttributes;        // mode attributes
  61.   unsigned char      WinAAttributes;        // window A attributes
  62.   unsigned char   WinBAttributes;        // window B attributes
  63.   unsigned short  WinGranularity;        // window granularity
  64.   unsigned short  WinSize;               // window size
  65.   unsigned short  WinASegment;           // window A start segment
  66.   unsigned short  WinBSegment;           // window B start segment
  67.   unsigned long      WinFuncPtr;            // pointer to window function
  68.   unsigned short  BytesPerScanLine;      // bytes per scan line
  69.  
  70.   // Mandatory information for VBE 1.2 and above:
  71.  
  72.   unsigned short  XResolution;           // horizontal resolution in pixels or chars
  73.   unsigned short  YResolution;           // vertical resolution in pixels or chars
  74.   unsigned char   XCharSize;             // character cell width in pixels
  75.   unsigned char      YCharSize;             // character cell height in pixels
  76.   unsigned char      NumberOfPlanes;        // number of memory planes
  77.   unsigned char      BitsPerPixel;          // bits per pixel
  78.   unsigned char      NumberOfBanks;         // number of banks
  79.   unsigned char      MemoryModel;           // memory model type
  80.   unsigned char      BankSize;              // bank size in KB
  81.   unsigned char      NumberOfImagePages;    // number of images
  82.   unsigned char      _Reserved;             // reserved for page function
  83.  
  84.   // Direct Color fields (required for direct/6 and YUV/7 memory models)
  85.  
  86.   unsigned char      RedMaskSize;           // size of direct color red mask in bits
  87.   unsigned char      RedFieldPosition;      // bit position of lsb of red mask
  88.   unsigned char      GreenMaskSize;         // size of direct color green mask in bits
  89.   unsigned char      GreenFieldPosition;    // bit position of lsb of green mask
  90.   unsigned char      BlueMaskSize;          // size of direct color blue mask in bits
  91.   unsigned char      BlueFieldPosition;     // bit position of lsb of blue mask
  92.   unsigned char      RsvdMaskSize;          // size of direct color reserved mask in bits
  93.   unsigned char      RsvdFieldPosition;     // bit position of lsb of reserved mask
  94.   unsigned char      DirectColorModeInfo;   // direct color mode attributes
  95.  
  96.   // Mandatory information for VBE 2.0 and above:
  97.  
  98.   unsigned long      PhysBasePtr;           // physical address for flat frame buffer
  99.   unsigned long      OffScreenMemOffset;    // pointer to start of off screen memory
  100.   unsigned short  OffScreenMemSize;      // amount of off screen memory in 1k units
  101.   char          __Reserved[206];
  102.  
  103. } VBEMODEINFO;
  104.  
  105. // Flags to combine with mode number
  106.  
  107. #define    VBE_MODEFLAG_NOCLEAR    0x8000    // Dont clear screen on mode set
  108. #define    VBE_MODEFLAG_LFB    0x4000    // Request LFB
  109.  
  110. // Mode attributes flags
  111.  
  112. #define VBEMODE_CAPS_AVAILABLE    (1<<0)    // Mode is available
  113. #define    VBEMODE_CAPS_TTYOUTPUT    (1<<2)    // TTY output is available
  114. #define    VBEMODE_CAPS_COLORMODE    (1<<3)    // Color video mode
  115. #define    VBEMODE_CAPS_GRAPHMODE    (1<<4)    // Graphics mode
  116. #define    VBEMODE_CAPS_NONVGA    (1<<5)    // Non-VGA mode
  117. #define    VBEMODE_CAPS_NONBANKED    (1<<6)    // Banked frame buffer not supported
  118. #define    VBEMODE_CAPS_LINEAR    (1<<7)    // Linear frame buffer is supported
  119.  
  120. // Mode memory models
  121.  
  122. #define    VBEMODE_MODEL_TEXT    (0)    // Text mode
  123. #define    VBEMODE_MODEL_CGA    (1)    // CGA mode
  124. #define    VBEMODE_MODEL_HERCULES    (2)    // Hercules graphics mode
  125. #define    VBEMODE_MODEL_PLANAR    (3)    // VGA planar style mode
  126. #define    VBEMODE_MODEL_PACKED    (4)    // Packed pixel mode
  127. #define    VBEMODE_MODEL_MODEX    (5)    // ModeX (unchained 4, 256 color)
  128. #define    VBEMODE_MODEL_RGB    (6)    // Direct color RGB
  129. #define    VBEMODE_MODEL_YUV    (7)    // Direct color YUV
  130.  
  131.  
  132. //▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  133. // Functions
  134. //▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  135.  
  136.  
  137. //    vbeDetect()
  138. //                Detect the VBE bios and get info from it.
  139. //                Also map the real mode pointers and memory
  140. //                into protected mode. Returns a pointer to
  141. //                a VBEINFO structure.
  142.                 VBEINFO *    vbeDetect(void);
  143.  
  144. //    vbeGetModeInfo(MODE,VBEMODEINFO *)
  145. //                Get video mode information. The VBEMODEINFO
  146. //                field is filled with info about the specified
  147. //                VBE mode. Returns 1 on success and 0 on
  148. //                failure.
  149.                 int        vbeGetModeInfo(long,VBEMODEINFO *);
  150.  
  151.  
  152. //    vbeOpen(X_RES,Y_RES,BPP)
  153. //                Open the VBE driver with the given screen
  154. //                metrics. Returns a pointer to a VBESURFACE
  155. //                structure on success, or NULL on failure.
  156.                 VBESURFACE *    vbeOpen(long,long,long);
  157.  
  158. //    vbeClose(VBESURFACE)
  159. //                Close the VBE driver for the given VBE
  160. //                SURFACE. The LFB is unmapped and the video
  161. //                mode is restored to 0x03.
  162.                 void        vbeClose(VBESURFACE *);
  163.  
  164. //    vbeSetScanWidth(PIXELS)
  165. //                Sets the number of pixels per scan line
  166. //                in screen memory. Returns 1 on success and
  167. //                0 on failure.
  168.                 int         vbeSetScanWidth(long);
  169.  
  170. //    vbeGetScanWidth()
  171. //                Returns the number of pixels per scan line
  172. //                in screen memory. Returns 0 on failure.
  173.                 long        vbeGetScanWidth(void);
  174.  
  175. //    vbeSetDisplayStart(X,Y)
  176. //                Set the display start position. Returns 1
  177. //                on success and 0 on failure.
  178.                 int         vbeSetDisplayStart(long,long);
  179.  
  180.  
  181. //    vbeGetDisplayStart(X *, Y *)
  182. //                Get X and Y display start position. The X
  183. //                and Y DWORD pointers are filled with the X
  184. //                and Y position. Returns 1 on success and 0
  185. //                on failure.
  186.                 int         vbeGetDisplayStart(long *,long *);
  187.  
  188. //    vbeVR()
  189. //                Wait for vertical retrace
  190.                 void            vbeVr(void);
  191.                 #pragma aux     vbeVr = \
  192.                     "mov    dx, 03dah"\
  193.                     "start: in al, dx"\
  194.                     "test   al, 8"\
  195.                     "jnz    start"\
  196.                     "mov    dx, 03dah"\
  197.                     "end:   in al, dx"\
  198.                     "test   al, 8"\
  199.                     "jz     end"\
  200.                     parm;
  201.  
  202. void            vmode(long);
  203. #pragma aux     vmode = "int 10h", parm [eax];
  204.  
  205. #ifdef __cplusplus
  206. }
  207. #endif
  208.  
  209. #endif